package com.alibaba.cloud.enums;

import java.util.HashMap;
import java.util.Map;


/**
 * The Enum CustomerHttpMethod.
 *
 * @ClassName: CustomerMediaType
 * @Description:定义CustomerMediaType 
 * @author: zhb1316783262@163.com
 * @date: 2020年3月29日上午11:48:08
 */
public enum CustomerHttpMethod {

    /** The get. */
    GET, /** The head. */
 HEAD, /** The post. */
 POST, /** The put. */
 PUT, /** The patch. */
 PATCH, /** The delete. */
 DELETE, /** The options. */
 OPTIONS, /** The trace. */
 TRACE;
    
    /** The Constant mappings. */
    private static final Map<String, CustomerHttpMethod> mappings = new HashMap<>(16);
    static {
        for (CustomerHttpMethod httpMethod : values()) {
            mappings.put(httpMethod.name(), httpMethod);
        }
    }

    /**
     * Resolve.
     *
     * @param method the method
     * @return the customer http method
     */
    public static CustomerHttpMethod resolve(String method) {
        return (method != null ? mappings.get(method) : null);
    }

    /**
     * Matches.
     *
     * @param method the method
     * @return true, if successful
     */
    public boolean matches(String method) {
        return (this == resolve(method));
    }
}